package com.zw.yzk.kabu.mapper;

import com.zw.yzk.kabu.data.network.entity.FansListEntity;
import com.zw.yzk.kabu.model.MyFansModel;

import java.util.ArrayList;
import java.util.List;

import javax.inject.Inject;

/**
 * Created by zhanwei on 2017/3/4.
 */

public class FansListMapper {

    @Inject
    public FansListMapper() {

    }

    public MyFansModel transfer(FansListEntity.Fans fans) {
        MyFansModel model = new MyFansModel();
        model.setHead(fans.head);
        model.setName(fans.nickName);
        model.setIntroduction(fans.introduction);
        model.setId(fans.fansId);
        model.setHasConcerned(fans.followState == 1 || fans.followState == 3);// 0:未关注 1:已关注 2:已被对方关注 3:互粉

        return model;
    }

    public List<MyFansModel> transfer(FansListEntity entity) {
        List<MyFansModel> models = new ArrayList<>();
        if(entity.result.fansList == null || entity.result.fansList.isEmpty()) {
            return models;
        }
        for(FansListEntity.Fans fans : entity.result.fansList) {
            models.add(transfer(fans));
        }

        return models;
    }
}
